#ifndef _TCPCONNECTION_H
#define _TCPCONNECTION_H

#include "SocketIO.h"
#include "Socket.h"
#include "InetAddress.h"
#include <string>

using namespace std;

class TcpConnection {
public: 

    explicit TcpConnection(int fd);

    ~TcpConnection();

    string receive();

    void send(const string & msg);

    //为了方便调试的函数
    string toString();

    private:
    //获取本端地址与对端地址
    InetAddress getLocalAddr();
    InetAddress getPeerAddr();

private: 
    SocketIO _sockIO;

    //为了调试而加入的三个数据成员
    Socket _sock;
    InetAddress _localAddr;
    InetAddress _peerAddr;
};

#endif 
